package com.nacl.grayLog.controller;

import com.nacl.grayLog.service.TestService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;


/**
 * @author Mr.NaCl
 * @since 2024/9/4
 */
@Slf4j
@Controller
public class TestController {
    @Resource
    private TestService testService;

    @RequestMapping("/hello")
    @ResponseBody
    public void showHelloWorld() {
        log.info("my name is HelloWorldController");
        testService.hello();
    }

    @GetMapping("log")
    public String log() {
        log.error("error");
        log.warn("warn");
        log.info("info");
        log.debug("debug");
        int i = 1 / 0;
        return "success";
    }
}
